package com.silp.baitap1;

import java.util.Random;

public class Ham {

	
	private static int k;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		cong();
		tru();
		nhan();
		chia();
		System.out.println();
		all();
		System.out.println();
		tatca();
		
	}

	private static void tatca() {
		int i = random();
		int j = random();
		int nhan = i*j;
		int cong = i+j;
		
		if((i==0)||(j==0)){
			System.out.println("Sai dieu kien");
		}
		else if (i<j) {
			System.out.println("Sai dieu kien");
			
		}
		else{
			int chia = i%j;
			int tru = i-j;
			System.out.println("Ket qua cong cua 2 so "+i+" va "+j+" la "+cong);
			System.out.println("Ket qua tru cua 2 so "+i+" va "+j+" la "+tru);
			System.out.println("Ket qua nhan cua 2 so "+i+" va "+j+" la "+nhan);
			System.out.println("Ket qua chia cua 2 so "+i+" va "+j+" la "+chia);
			
		}
		
		}
		
	

	private static void all() {
	
			cong();
			tru();
			nhan();
			chia();
	}
	

	private static int chia( ) {
		int i=random();
		int j=random();
		if ((i==0)||(j==0)){
			System.out.println("Sai dieu kien !!!");
		}
		else{
			k=i%j;
			System.out.println("Ket qua chia cua 2 so "+i+" va "+j+" la "+k);
		}
		return k;
	}

	private static int nhan() {
		int i=random();
		int j=random();
		k=i*j;
		System.out.println("Ket qua nhan cua 2 so "+i+" va "+j+" la "+k);
		return k;
	}

	private static int tru() {
		int i=random();
		int j=random();
		if ((i==0)||(j==0)||(i<j)){
			System.out.println("Sai dieu kien !!!");
		}
		else{
			k=i-j;
			System.out.println("Ket qua tru cua 2 so "+i+" va "+j+" la "+k);
		}
		return k;
	}

	private static int cong() {
		int i=random();
		int j=random();
		k=i+j;
		System.out.println("Ket qua cong cua 2 so "+i+" va "+j+" la "+k);
		return k;
		
	}

	public static int random() {
		Random r=new Random();
		int j=r.nextInt(100);
		//System.out.println(j);
		return j;
	}

}
